//reducer就是一个函数,并且是个纯函数 用于给store计算出新的state

import { combineReducers } from "redux";
import chatlogReducer from "./chatlogReducer";
import nicknameReducer from "./nicknameReducer";
import productReducer from "./productReducer";
import statusReducer from "./statusReducer";

//接收state action作为参数 并且返回一个新的state

// let initialState = ["学react", "学vue3"]

// let initialState = 20

// const rootReducer = (state = initialState, action) => {
//     let { type, payload } = action;
//     // console.log(action)
//     switch (type) {
//         //自增
//         case "INCREASE_COUNT":
//             return state + payload
//         case "DECREASE_COUNT":
//             return state - payload
//         default:
//             return state
//     }
// }

// export default rootReducer


const rootReducer = combineReducers({
    chatlog: chatlogReducer,
    nickname: nicknameReducer,
    status: statusReducer,
    product: productReducer
})

export default rootReducer